/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ep.persistence.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Spyros
 */
@Entity
@Table(name = "t005_patient", catalog = "epresc", schema = "")
@NamedQueries({
    @NamedQuery(name = "T005Patient.findAll", query = "SELECT t FROM T005Patient t"),
    @NamedQuery(name = "T005Patient.findById", query = "SELECT t FROM T005Patient t WHERE t.id = :id"),
    @NamedQuery(name = "T005Patient.findByFirstName", query = "SELECT t FROM T005Patient t WHERE t.firstName = :firstName"),
    @NamedQuery(name = "T005Patient.findBySurname", query = "SELECT t FROM T005Patient t WHERE t.surname = :surname"),
    @NamedQuery(name = "T005Patient.findByAmka", query = "SELECT t FROM T005Patient t WHERE t.amka = :amka"),
    @NamedQuery(name = "T005Patient.findByAddress", query = "SELECT t FROM T005Patient t WHERE t.address = :address"),
    @NamedQuery(name = "T005Patient.findByTk", query = "SELECT t FROM T005Patient t WHERE t.tk = :tk"),
    @NamedQuery(name = "T005Patient.findByCity", query = "SELECT t FROM T005Patient t WHERE t.city = :city"),
    @NamedQuery(name = "T005Patient.findByYearOfBirth", query = "SELECT t FROM T005Patient t WHERE t.yearOfBirth = :yearOfBirth"),
    @NamedQuery(name = "T005Patient.findByPhone", query = "SELECT t FROM T005Patient t WHERE t.phone = :phone")})
public class T005Patient implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "first_name")
    private String firstName;
    @Basic(optional = false)
    @Column(name = "surname")
    private String surname;
    @Basic(optional = false)
    @Column(name = "amka")
    private String amka;
    @Column(name = "address")
    private String address;
    @Column(name = "tk")
    private String tk;
    @Column(name = "city")
    private String city;
    @Column(name = "yearOfBirth")
    private Integer yearOfBirth;
    @Column(name = "phone")
    private String phone;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "t005Patient", fetch = FetchType.LAZY)
    private Collection<T005T007> t005T007Collection;
    @JoinColumn(name = "t004_insurance_id", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private T004Insurance t004Insurance;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "t005Patient", fetch = FetchType.LAZY)
    private Collection<T006Prescription> t006PrescriptionCollection;

    public T005Patient() {
    }

    public T005Patient(Integer id) {
        this.id = id;
    }

    public T005Patient(Integer id, String firstName, String surname, String amka) {
        this.id = id;
        this.firstName = firstName;
        this.surname = surname;
        this.amka = amka;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public String getAmka() {
        return amka;
    }

    public void setAmka(String amka) {
        this.amka = amka;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getTk() {
        return tk;
    }

    public void setTk(String tk) {
        this.tk = tk;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public Integer getYearOfBirth() {
        return yearOfBirth;
    }

    public void setYearOfBirth(Integer yearOfBirth) {
        this.yearOfBirth = yearOfBirth;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Collection<T005T007> getT005T007Collection() {
        return t005T007Collection;
    }

    public void setT005T007Collection(Collection<T005T007> t005T007Collection) {
        this.t005T007Collection = t005T007Collection;
    }

    public T004Insurance getT004Insurance() {
        return t004Insurance;
    }

    public void setT004Insurance(T004Insurance t004Insurance) {
        this.t004Insurance = t004Insurance;
    }

    public Collection<T006Prescription> getT006PrescriptionCollection() {
        return t006PrescriptionCollection;
    }

    public void setT006PrescriptionCollection(Collection<T006Prescription> t006PrescriptionCollection) {
        this.t006PrescriptionCollection = t006PrescriptionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof T005Patient)) {
            return false;
        }
        T005Patient other = (T005Patient) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return   firstName + " " + surname ;
    }

}
